import Vue from 'vue'
import Router from 'vue-router'
import menu from '@/views/menu/menu';
Vue.use(Router);


// 解决ElementUI导航栏中的vue-router在3.0版本以上重复点菜单报错问题
const originalPush = Router.prototype.push;
Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

export let constantRoutes = [
      /**登录页面*/
      {
        path: '/login',
        component: ()=>import('@/views/login/login'),
        hidden: true,
        meta: {title: "登录"}
      },
      /**首页*/
        {
          path: "/",
          mode:'history',
          component: ()=>import('@/views/index/index'),
          meta: {title: "首页"}
        },
      {
        path: "/index",
        mode:'history',
        component: ()=>import('@/views/index/index'),
        meta: {title: "首页"}
      },
      /**菜单主页*/
      {
        path: '/menu/index',
        component: menu,
        meta: {title: "菜单管理"}
      },
  ];

export let router = new Router({
    mode:'history',
    routes:constantRoutes
});
